package com.wondersgroup.fjzlpt.console.controller.rest.role;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;
import com.quick.framework.boot.web.utils.RequestUtils;
import com.wondersgroup.fjzlpt.console.service.inter.role.RoleService;

@RestController
@RequestMapping("/role")
public class RoleRestController {
	@Autowired
	private RoleService roleService;
	
	/**
	 * 查询角色分页信息
	 * 
	 * @param request
	 * @return
	 */
	@RequestMapping("/queryPageRole")
	public JSONObject queryPageRole(HttpServletRequest request) {
		Map<String, String> map = RequestUtils.GetParameterMap(request);
		return roleService.queryPage(map);
	}

	/**
	 * 保存角色信息
	 * 
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "save")
	public JSONObject save(HttpServletRequest request) {
		Map<String, String> map = RequestUtils.GetParameterMap(request);
		JSONObject jsonObject = roleService.save(map);
		return jsonObject;
	}

	/**
	 * 删除角色
	 * 
	 * @param request
	 * @return
	 */
	@RequestMapping("/delete")
	public JSONObject delete(HttpServletRequest request) {
		Map<String, String> map = RequestUtils.GetParameterMap(request);
		JSONObject jsonObject = roleService.delete(map);
		return jsonObject;
	}
	/**
	 * 查询角色
	 * 
	 * @param request
	 * @return
	 */
//	@RequestMapping("/queryRole")
//	common JSONObject queryRole(HttpServletRequest request) {
//		Map<String, String> map = RequestUtils.GetParameterMap(request);
//		JSONObject jsonObject = roleService.queryRole(map);
//		return jsonObject;
//	}
}
